package com.productssite.model;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Product entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "product", catalog = "productssalessite")
public class Product implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer idProduct;
	private ProductCategory productcategory;
	private String name;
	private Timestamp creationDate;
	private String xsd;
	private String xmlData;
	private Set<Attribute> attributes = new HashSet<Attribute>(0);

	// Constructors

	/** default constructor */
	public Product() {
	}

	/** minimal constructor */
	public Product(Integer idProduct) {
		this.idProduct = idProduct;
	}

	/** full constructor */
	public Product(Integer idProduct, ProductCategory productcategory,
			String name, Timestamp creationDate, String xsd, String xmlData,
			Set<Attribute> attributes) {
		this.idProduct = idProduct;
		this.productcategory = productcategory;
		this.name = name;
		this.creationDate = creationDate;
		this.xsd = xsd;
		this.xmlData = xmlData;
		this.attributes = attributes;
	}

	// Property accessors
	@Id
	@Column(name = "idProduct", unique = true, nullable = false)
	public Integer getIdProduct() {
		return this.idProduct;
	}

	public void setIdProduct(Integer idProduct) {
		this.idProduct = idProduct;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idProductCategory")
	public ProductCategory getProductcategory() {
		return this.productcategory;
	}

	public void setProductcategory(ProductCategory productcategory) {
		this.productcategory = productcategory;
	}

	@Column(name = "Name", length = 254)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "creationDate", length = 19)
	public Timestamp getCreationDate() {
		return this.creationDate;
	}

	public void setCreationDate(Timestamp creationDate) {
		this.creationDate = creationDate;
	}

	@Column(name = "xsd", length = 65535)
	public String getXsd() {
		return this.xsd;
	}

	public void setXsd(String xsd) {
		this.xsd = xsd;
	}

	@Column(name = "xmlData", length = 65535)
	public String getXmlData() {
		return this.xmlData;
	}

	public void setXmlData(String xmlData) {
		this.xmlData = xmlData;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public Set<Attribute> getAttributes() {
		return this.attributes;
	}

	public void setAttributes(Set<Attribute> attributes) {
		this.attributes = attributes;
	}

}